﻿@model GroupEntity
@{
    string returnUrl = ViewData.Get<string>("returnUrl", string.Empty);
}
@{
    var list = new GroupService().GetGroupMembers(Model.GroupId);
    var listgroup=new GroupRepository().GetAll();
    var listselect=new List<SelectListItem>();
    foreach( var group in listgroup)
    {
        listselect.Add(new SelectListItem(){ Text=group.GroupName, Value=group.GroupId.ToString()});
    }
}
<style type="text/css">
    #select1, #select2 { width: 150px; height: 167px; padding: 5px; }
    .content1 { float: left; text-align: center; margin-right: 10px; }
    .content1 span { display: block; width: 100px; background: #eee; cursor: pointer; border: 1px solid #ccc; padding: 5px 0; margin: 5px 0; }
</style>
<script type="text/javascript">
    // JavaScript Document
    $(document).ready(function () {
        $("#add1").click(function () {
            $("#select1 option:selected").appendTo("#select2");
        });
        $("#add_all1").click(function () {
            $("#select1 option").appendTo("#select2");
        });
        $("#remove1").click(function () {
            $("#select2 option:selected").appendTo("#select1");
        });
        $("#remove_all1").click(function () {
            $("#select2 option").appendTo("#select1");
        });
        $("#select1").dblclick(function () {
            $("#select1 option:selected").appendTo("#select2");
        });
        $("#select2").dblclick(function () {
            $("#select2 option:selected").appendTo("#select1");
        });
    });
</script>
<div id="editUserRankDialog" class="tnc-edit-rec-type">
    @using (Html.BeginAjaxForm("_ChangeGroupMember", "GroupSpaceSettings", new { spaceKey = Url.SpaceKey(), returnUrl = returnUrl }, FormMethod.Post, new AjaxFormOptions { OnSuccessCallBack = "OnSuccessCallBack", OnErrorCallBack = "OnErrorCallBack" }))
    {
        <div class="tnc-dailog-pd" style="height:260px;">
           
                    <!--转让会员 -->
                    <div class="content1">
                        <div style="height:36px; line-height:36px;">商户：@Model.GroupName</div>
                        <select multiple="multiple" id="select1">
                            @{
        if (list != null)
        {
            foreach (var temp in list)
            { 
               <option value="@temp.UserId">@temp.User.UserName</option>
            }
        }
                                
                            }
                        </select>
                        <span id="add1">选中右移>></span> <span id="add_all1">全部右移>></span>
                    </div>
                    <div class="content1">
                        <div style="height:36px; line-height:36px;">
                           商户：@Html.DropDownList("group1", listselect, new { id = "group1", name = "group1" })
                        </div>
                        <select multiple="multiple" id="select2" name="select2"></select>
                        <span id="remove1">选中左移>></span><span id="remove_all1">全部左移>></span>
                    </div>

                   <!-- 转让会员-->
        </div>
        <div class="tnc-artdilog-btn tn-border-gray tn-border-top tn-bg-gray">
            @Html.Button("确定", ButtonTypes.Submit, HighlightStyles.Primary)
            @Html.Button("取消", ButtonTypes.Cancel, HighlightStyles.Secondary, htmlAttributes: new { dialogOperation = "close" })
        </div>
    }
    <script type="text/dialog">

        this.title("转让会员");

    </script>
    <script type="text/javascript" language="javascript">

        function OnSuccessCallBack(data) {
            art.dialog.tips(data.MessageContent, 1.5, data.MessageType,
            function () {
                window.location.href = '@Html.Raw(returnUrl)';
            })
        }

        function OnErrorCallBack(response) {
            $("#editUserRankDialog").replaceWith(response);
        }
    </script>
</div>
